Skip to content

tclPackages_9_0.expect: init at 5.45.4#490930

Open
randomizedcoder wants to merge 2 commits intoNixOS:masterfrom
randomizedcoder:expect9
Open

tclPackages_9_0.expect: init at 5.45.4#490930
randomizedcoder wants to merge 2 commits intoNixOS:masterfrom
randomizedcoder:expect9

Conversation

@randomizedcoder
Copy link
Copy Markdown
Contributor

Expect 5.45.4 built against Tcl 9.0. - The primary advantage is 64 bit addressing from TCL 9.0

This adds a new expect9 package that provides Expect compiled against Tcl 9.0, alongside the existing expect package (Tcl 8.6).

Tcl 9 compatibility required:

  • Channel driver update to TCL_CHANNEL_VERSION_5 (tcl9-channel.patch)
  • Function signatures: int objc -> Tcl_Size objc (tcl9-size.patch)
  • Compatibility header for removed macros (ANSI_ARGS, CONST*, etc.)
  • Tcl_EvalTokens wrapper using Tcl_EvalTokensStandard
  • Fix Tcl_Size parameters to prevent stack buffer overflow

Testing performed:

  • All 29 upstream tests pass (tests/all.tcl)
  • Basic spawn/send/expect functionality verified
  • Regex pattern matching verified (this was particularly sensitive to Tcl_Size changes)

See also: Tcl 9.0 Porting Guide

Things done

  • Built on platform:
    • x86_64-linux
    • aarch64-linux
    • x86_64-darwin
    • aarch64-darwin
  • Tested, as applicable:
  • Ran nixpkgs-review on this PR. See nixpkgs-review usage.
  • Tested basic functionality of all binary files, usually in ./result/bin/.
  • Nixpkgs Release Notes
    • Package update: when the change is major or breaking.
  • NixOS Release Notes
    • Module addition: when adding a new NixOS module.
    • Module update: when the change is significant.
  • Fits CONTRIBUTING.md, pkgs/README.md, maintainers/README.md and other READMEs.

@nixos-discourse
Copy link
Copy Markdown

This pull request has been mentioned on NixOS Discourse. There might be relevant details there:

https://discourse.nixos.org/t/prs-ready-for-review/3032/6416

@nixpkgs-ci nixpkgs-ci bot requested a review from fgaz February 16, 2026 04:04
@nixpkgs-ci nixpkgs-ci bot added 8.has: package (new) This PR adds a new package 10.rebuild-linux: 1-10 This PR causes between 1 and 10 packages to rebuild on Linux. 10.rebuild-darwin: 1-10 This PR causes between 1 and 10 packages to rebuild on Darwin. 10.rebuild-darwin: 1 This PR causes 1 package to rebuild on Darwin. 10.rebuild-linux: 1 This PR causes 1 package to rebuild on Linux. 6.topic: tcl Dynamic, multi-paradigm programming language labels Feb 16, 2026
@randomizedcoder
Copy link
Copy Markdown
Contributor Author

I really need to add some commit hooks to run nix fmt ;)

Copy link
Copy Markdown
Member

@fgaz fgaz left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sorry but I don't think I could review this amount of code any time soon. Is there a reason why we can't use the BAWT fork as OpenMandriva does? Have you considered collaborating with the BAWT and OpenMandriva people to push for a more official release? Here's a relevant thread.

Also was a LLM involved in producing this PR?

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'd really like to avoid having tcl9 variants of single packages, going for something like #433414 instead.

@randomizedcoder
Copy link
Copy Markdown
Contributor Author

G'day,

Thanks for the feedback.

I'm certainly happy make a new version that uses options, like #433414

Are you concerned all.tcl test has coverage gaps? If you have concerns about the testing, then coverage should be increased, which should also improve expect even on tcl 8.6.

I've been hammering expect with tcl 9 via the integration tests here, and it seems to be working well.
https://github.com/randomizedcoder/ssh-tool

LLM? Yes, absolutely. The LLM helped find and solve each failing test, but LLM wanted to make a million patches, so after some encouragement many common replacements are done via sed.

Kind regards,
Dave

Something pretty impressive - LLM porting kernel patches from 5.x to 6.x: https://youtu.be/xRvi3k8XV8E?si=Z25SSDdI6mOZVapr

@randomizedcoder
Copy link
Copy Markdown
Contributor Author

@fgaz

During more testing, I found a bug, which I've now corrected.

However this got me worried, so I've added a 126 more tests, which did uncover more issues. These are now corrected.

The tests do try to focus on 32 v 64 bit changes.

randomizedcoder and others added 2 commits March 13, 2026 18:51
- 126 Tcl 9 specific tests run during build
- Full Tcl 9 API compatibility (channel driver, Tcl_Size, removed macros)
- 64-bit buffer support: match_max accepts values >2GB (key Tcl 9 benefit)
- Fix buffer truncation chain: ExpUniBuf, new_msize, numchars all use Tcl_Size
- Fix event handler race condition in close order
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

6.topic: tcl Dynamic, multi-paradigm programming language 8.has: package (new) This PR adds a new package 10.rebuild-darwin: 1-10 This PR causes between 1 and 10 packages to rebuild on Darwin. 10.rebuild-darwin: 1 This PR causes 1 package to rebuild on Darwin. 10.rebuild-linux: 1-10 This PR causes between 1 and 10 packages to rebuild on Linux. 10.rebuild-linux: 1 This PR causes 1 package to rebuild on Linux.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants